#include <iostream>
#include <vector>
using namespace std;




void insertionSort(vector<int> & ivec)
{
	int p = 0;
	int temp = 0;
	int hole = 0;

	for (p = 1; p < ivec.size(); ++p)
	{
		temp = ivec[p];
		for (hole = p; hole > 0 && ivec[hole - 1] > temp; hole--)
		{
			ivec[hole] = ivec[hole - 1];

		}
		ivec[hole] = temp;
	}
}


int main()
{
	int input;
	vector<int> ivec;
	while (1)
	{
		cin >> input;
		if (input == 12306)
		{
			insertionSort(ivec);
		}
		else if (input == 12312)
		{
			for (int i = 0; i < ivec.size(); ++i)
			{
				cout << ivec[i] << " ";
			}
		}
		else{
			ivec.push_back(input);
		}
		
	}
}